#!/usr/bin/python
# -*- coding: <utf-8> -*-
import os.path
import pymongo
import tornado.web
from handler import *


class Application(tornado.web.Application):
    def __init__(self):
        handler = [('/', IndexHandler), ('/blog', BlogHandler), ('/blogedit', blogEditHandler),
                   ('/login', LoginHandler), ('/signup', SignupHandler), ('/isa', IsaHandler),
                   ('/activity', ActivityHandler),
                   ('/talk', TalkHandler), ('/note', NoteHandler), ('/notedit', NoteEditHandler),
                   ('/talks', Talkdelete_Handler), ('/admin', AdminHandler), ('/upLoad', UpLoadHandler),
                   ('/logout', LogoutHandler)]
        settings = dict(
            cookie_secret="61oETzKXQAGaYdkL5gEmGeJJFuYh7EQnp2XdTP1o/Vo=",
            login_url="/login",
            template_path=os.path.join(os.path.dirname(__file__), "templates"),
            static_path=os.path.join(os.path.dirname(__file__), "static"),
            debug=True,
        )
        connection = pymongo.MongoClient()
        self.db = connection.web
        tornado.web.Application.__init__(self, handler, **settings)
